/**
 *  iBizSys 5.0 机器人生产代码（不要直接修改当前代码）
 *  http://www.ibizsys.net
 */
package com.sa.ibiz.demo.srv.demo.service;


import java.util.ArrayList;
import java.util.List;
import java.util.HashMap;

import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.stereotype.Component;
import net.ibizsys.paas.exception.ErrorException;
import net.ibizsys.paas.core.PluginActionResult;
import net.ibizsys.paas.core.IDataEntity;
import net.ibizsys.paas.core.IDEDataSetFetchContext;
import net.ibizsys.paas.db.DBCallResult;
import net.ibizsys.paas.db.DBFetchResult;
import net.ibizsys.paas.db.IProcParam;
import net.ibizsys.paas.util.StringHelper;
import net.ibizsys.paas.util.StringBuilderEx;
import net.ibizsys.paas.core.Errors;
import net.ibizsys.paas.core.ActionContext;
import net.ibizsys.paas.data.DataObject;
import net.ibizsys.paas.service.ServiceGlobal;
import net.ibizsys.paas.entity.IEntity;
import net.ibizsys.paas.demodel.IDataEntityModel;
import net.ibizsys.paas.demodel.DEModelGlobal;
import net.ibizsys.paas.demodel.IDELogicModel;
import net.ibizsys.paas.dao.DAOGlobal;
import net.ibizsys.paas.web.WebContext;
import net.ibizsys.paas.service.IService;
import net.ibizsys.paas.util.DataTypeHelper;
import net.ibizsys.paas.util.KeyValueHelper;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import net.ibizsys.paas.db.SelectCond;
import net.ibizsys.paas.service.IServiceWork;
import net.ibizsys.paas.service.IServicePlugin;
import net.ibizsys.paas.service.ITransaction;
import net.ibizsys.paas.dao.IDAO;
import net.ibizsys.paas.service.CloneSession;
import net.ibizsys.paas.service.ServiceBase;
import net.ibizsys.paas.entity.EntityFieldError;
import net.ibizsys.paas.entity.EntityError;
import java.sql.Timestamp;
import net.ibizsys.paas.util.DefaultValueHelper;
import javax.annotation.PostConstruct;
import net.ibizsys.paas.service.IDataContextParam;
import net.sf.json.JSONObject;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;



import com.sa.ibiz.demo.srv.demo.entity.IBZ5ORDERDETAIL;
import com.sa.ibiz.demo.srv.demo.dao.IBZ5ORDERDETAILDAO;
import com.sa.ibiz.demo.srv.demo.demodel.IBZ5ORDERDETAILDEModel;


/**
 * 实体[IBZ5ORDERDETAIL] 服务对象基类
 */
@Component
public class IBZ5ORDERDETAILService extends com.sa.ibiz.demo.srv.MyTestSysSysServiceBase<IBZ5ORDERDETAIL> {
    private static final Log log = LogFactory.getLog(IBZ5ORDERDETAILService.class);
    /**
     * 实体数据集合[DEFAULT]标识
     */
    public final static String DATASET_DEFAULT = "DEFAULT";


    public IBZ5ORDERDETAILService () {
        super();

    }

    /**
     * 获取实体[IBZ5ORDERDETAIL]服务对象
     * @param sessionFactory
     * @return
     * @throws Exception
     */
    public static IBZ5ORDERDETAILService getInstance() throws Exception {
        return getInstance(null);
    }

    /**
     * 获取实体[IBZ5ORDERDETAIL]服务对象
     * @param sessionFactory
     * @return
     * @throws Exception
     */
    public static IBZ5ORDERDETAILService getInstance(SessionFactory sessionFactory) throws Exception {
        return (IBZ5ORDERDETAILService)ServiceGlobal.getService(IBZ5ORDERDETAILService.class, sessionFactory);
    }

    /**
     * Spring注册后执行构造处理
     * @throws Exception
     */
    @PostConstruct
    public void postConstruct() throws Exception {
        ServiceGlobal.registerService(getServiceId(), this);
    }

    /* (non-Javadoc)
     * @see net.ibizsys.paas.service.ServiceBase#getServiceId()
     */
    @Override
    protected String getServiceId() {
        return "com.sa.ibiz.demo.srv.demo.service.IBZ5ORDERDETAILService";
    }

    private IBZ5ORDERDETAILDEModel iBZ5ORDERDETAILDEModel;
    /**
     * 获取实体[IBZ5ORDERDETAIL]模型对象
     */
    public  IBZ5ORDERDETAILDEModel getIBZ5ORDERDETAILDEModel() {
        if(this.iBZ5ORDERDETAILDEModel==null) {
            try {
                this.iBZ5ORDERDETAILDEModel = (IBZ5ORDERDETAILDEModel)DEModelGlobal.getDEModel("com.sa.ibiz.demo.srv.demo.demodel.IBZ5ORDERDETAILDEModel");
            } catch(Exception ex) {
            }
        }
        return this.iBZ5ORDERDETAILDEModel;
    }

    /* (non-Javadoc)
     * @see net.ibizsys.paas.service.ServiceBase#getDEModel()
     */
    @Override
    public  IDataEntityModel getDEModel() {
        return this.getIBZ5ORDERDETAILDEModel();
    }


    private IBZ5ORDERDETAILDAO iBZ5ORDERDETAILDAO;

    /**
     * 获取实体[IBZ5ORDERDETAIL]数据操作对象
     */
    public  IBZ5ORDERDETAILDAO getIBZ5ORDERDETAILDAO() {
        if(this.iBZ5ORDERDETAILDAO==null) {
            try {
                this.iBZ5ORDERDETAILDAO= (IBZ5ORDERDETAILDAO)DAOGlobal.getDAO("com.sa.ibiz.demo.srv.demo.dao.IBZ5ORDERDETAILDAO",this.getSessionFactory());
            } catch(Exception ex) {
            }
        }
        return this.iBZ5ORDERDETAILDAO;
    }

    /* (non-Javadoc)
     * @see net.ibizsys.paas.service.IService#getDAO()
     */
    @Override
    public  IDAO getDAO() {
        return this.getIBZ5ORDERDETAILDAO();
    }

    /* (non-Javadoc)
     * @see net.ibizsys.paas.service.ServiceBase#onfetchDataSet(java.lang.String, net.ibizsys.paas.core.IDEDataSetFetchContext)
     */
    @Override
    protected DBFetchResult onfetchDataSet(String strDataSetName,IDEDataSetFetchContext iDEDataSetFetchContext) throws Exception {
        if(StringHelper.compare(strDataSetName,DATASET_DEFAULT,true)==0) {
            return this.fetchDefault(iDEDataSetFetchContext);
        }
        return super.onfetchDataSet(strDataSetName,iDEDataSetFetchContext);
    }


    /* (non-Javadoc)
     * @see net.ibizsys.paas.service.ServiceBase#onExecuteAction(java.lang.String, net.ibizsys.paas.entity.IEntity)
     */
    @Override
    protected  void onExecuteAction(String strAction,IEntity entity) throws Exception {
        super.onExecuteAction(strAction,entity);
    }

    /**
     * 获取数据集合[DEFAULT]
     * @param iDEDataSetFetchContext
     * @return
     * @throws Exception
     */
    public DBFetchResult fetchDefault(IDEDataSetFetchContext iDEDataSetFetchContext) throws Exception {

        DBFetchResult dbFetchResult =  doServiceFetchWork(iDEDataSetFetchContext,DATASET_DEFAULT,false);
        // dbFetchResult.getDataSet().cacheDataRow();
        // session.close();
        return dbFetchResult;
    }







    /* (non-Javadoc)
     * @see net.ibizsys.paas.service.ServiceBase#onFillParentInfo(net.ibizsys.paas.entity.IEntity, java.lang.String, java.lang.String, java.lang.String)
     */
    @Override
    protected void onFillParentInfo(IBZ5ORDERDETAIL et,String strParentType,String strTypeParam,String strParentKey) throws Exception {
        //关系类型 : DER1N ,主实体 :IBZ5ORDER / 订单
        if (((StringHelper.compare(strParentType, WebContext.PARAM_PARENTTYPE_DER1N, true) == 0)
                ||(StringHelper.compare(strParentType, WebContext.PARAM_PARENTTYPE_SYSDER1N, true) == 0)
                ||(StringHelper.compare(strParentType, WebContext.PARAM_PARENTTYPE_DER11, true) == 0)
                ||(StringHelper.compare(strParentType, WebContext.PARAM_PARENTTYPE_SYSDER11, true) == 0))
                && (StringHelper.compare(strTypeParam, "DER1N_IBZ5ORDERDETAIL_IBZ5ORDER_IBZ5ORDERID", true)==0)) {
            IService iService= ServiceGlobal.getService("com.sa.ibiz.demo.srv.demo.service.IBZ5ORDERService",this.getSessionFactory());
            com.sa.ibiz.demo.srv.demo.entity.IBZ5ORDER parentEntity = ( com.sa.ibiz.demo.srv.demo.entity.IBZ5ORDER)iService.getDEModel().createEntity();
            parentEntity.set(com.sa.ibiz.demo.srv.demo.entity.IBZ5ORDER.FIELD_IBZ5ORDERID,DataTypeHelper.parse(25,strParentKey));
            if(strParentKey.indexOf(ServiceBase.TEMPKEY) == 0)
                iService.getTemp(parentEntity);
            else
                iService.get(parentEntity);
            this.onFillParentInfo_IBZ5ORDER(et,parentEntity );
            return;
        }
        //关系类型 : DER1N ,主实体 :IBZ5UNITPRODUCT / 统一产品（索引主实体）
        if (((StringHelper.compare(strParentType, WebContext.PARAM_PARENTTYPE_DER1N, true) == 0)
                ||(StringHelper.compare(strParentType, WebContext.PARAM_PARENTTYPE_SYSDER1N, true) == 0)
                ||(StringHelper.compare(strParentType, WebContext.PARAM_PARENTTYPE_DER11, true) == 0)
                ||(StringHelper.compare(strParentType, WebContext.PARAM_PARENTTYPE_SYSDER11, true) == 0))
                && (StringHelper.compare(strTypeParam, "DER1N_IBZ5ORDERDETAIL_IBZ5UNITPRODUCT_IBZ5UNITPRODUCTID", true)==0)) {
            IService iService= ServiceGlobal.getService("com.sa.ibiz.demo.srv.demo.service.IBZ5UNITPRODUCTService",this.getSessionFactory());
            com.sa.ibiz.demo.srv.demo.entity.IBZ5UNITPRODUCT parentEntity = ( com.sa.ibiz.demo.srv.demo.entity.IBZ5UNITPRODUCT)iService.getDEModel().createEntity();
            parentEntity.set(com.sa.ibiz.demo.srv.demo.entity.IBZ5UNITPRODUCT.FIELD_IBZ5UNITPRODUCTID,DataTypeHelper.parse(25,strParentKey));
            if(strParentKey.indexOf(ServiceBase.TEMPKEY) == 0)
                iService.getTemp(parentEntity);
            else
                iService.get(parentEntity);
            this.onFillParentInfo_IBZ5UNITPRODUCT(et,parentEntity );
            return;
        }
        super.onFillParentInfo(et,strParentType,strTypeParam,strParentKey);
    }

    /* (non-Javadoc)
     * @see net.ibizsys.paas.service.ServiceBase#onSyncDER1NData(java.lang.String, java.lang.String, java.lang.String)
     */
    @Override
    protected String onSyncDER1NData(String strDER1NId, String strParentKey, String strDatas) throws Exception {
        return super.onSyncDER1NData( strDER1NId,  strParentKey,  strDatas);
    }


    /**
    * 填充数据的父数据信息[订单]
    * @param et 当前数据对象
    * @param parentEntity 父数据对象
    * @throws Exception
    */
    protected void onFillParentInfo_IBZ5ORDER(IBZ5ORDERDETAIL et,com.sa.ibiz.demo.srv.demo.entity.IBZ5ORDER parentEntity) throws Exception {
        et.setIBZ5ORDERId(parentEntity.getIBZ5ORDERId());
        et.setIBZ5ORDERName(parentEntity.getIBZ5ORDERName());
        et.setORDERUID(parentEntity.getORDERUID());
    }

    /**
    * 填充数据的父数据信息[统一产品（索引主实体）]
    * @param et 当前数据对象
    * @param parentEntity 父数据对象
    * @throws Exception
    */
    protected void onFillParentInfo_IBZ5UNITPRODUCT(IBZ5ORDERDETAIL et,com.sa.ibiz.demo.srv.demo.entity.IBZ5UNITPRODUCT parentEntity) throws Exception {
        et.setIBZ5UNITPRODUCTId(parentEntity.getIBZ5UNITPRODUCTId());
        et.setIBZ5UNITPRODUCTName(parentEntity.getIBZ5UNITPRODUCTName());
        et.setUNIT(parentEntity.getUNIT());
        et.setUnitPrice(parentEntity.getUnitPrice());
    }




    /* (non-Javadoc)
     * @see net.ibizsys.paas.service.ServiceBase#onFillEntityFullInfo(net.ibizsys.paas.entity.IEntity, boolean)
     */
    @Override
    protected void onFillEntityFullInfo(IBZ5ORDERDETAIL et, boolean bCreate) throws Exception {
        //填充新建默认值
        if(bCreate) {
        }
        super.onFillEntityFullInfo(et, bCreate);

        //填充物理化外键相关属性
        //关系类型 : DER1N ,主实体 :IBZ5ORDER / 订单
        onFillEntityFullInfo_IBZ5ORDER(et, bCreate);
        //关系类型 : DER1N ,主实体 :IBZ5UNITPRODUCT / 统一产品（索引主实体）
        onFillEntityFullInfo_IBZ5UNITPRODUCT(et, bCreate);
    }

    /**
    * 填充实体的数据信息 订单
    * @param et
    * @param bCreate 是否建立
    * @throws Exception
    */
    protected void onFillEntityFullInfo_IBZ5ORDER(IBZ5ORDERDETAIL et, boolean bCreate) throws Exception {
    }
    /**
    * 填充实体的数据信息 统一产品（索引主实体）
    * @param et
    * @param bCreate 是否建立
    * @throws Exception
    */
    protected void onFillEntityFullInfo_IBZ5UNITPRODUCT(IBZ5ORDERDETAIL et, boolean bCreate) throws Exception {
    }

    /* (non-Javadoc)
     * @see net.ibizsys.paas.service.ServiceBase#onWriteBackParent(net.ibizsys.paas.entity.IEntity, boolean)
     */
    @Override
    protected void onWriteBackParent(IBZ5ORDERDETAIL et, boolean bCreate) throws Exception {
        super.onWriteBackParent(et, bCreate);
    }




    /**
     * 通过关系[订单]父数据查询数据
     * @param parentEntity 父数据
     * @throws Exception
     */
    public java.util.ArrayList<IBZ5ORDERDETAIL> selectByIBZ5ORDER(com.sa.ibiz.demo.srv.demo.entity.IBZ5ORDER parentEntity) throws Exception {
        return selectByIBZ5ORDER(parentEntity,"");
    }
    /**
     * 通过关系[订单]父数据查询数据
     * @param parentEntity 父数据
     * @param strOrderInfo 排序信息
     * @throws Exception
     */
    public java.util.ArrayList<IBZ5ORDERDETAIL> selectByIBZ5ORDER(com.sa.ibiz.demo.srv.demo.entity.IBZ5ORDER parentEntity,String strOrderInfo) throws Exception {
        SelectCond selectCond = new SelectCond();
        selectCond.setConditon(IBZ5ORDERDETAIL.FIELD_IBZ5ORDERID, parentEntity.getIBZ5ORDERId());
        selectCond.setOrderInfo(strOrderInfo);
        onFillSelectByIBZ5ORDERCond(selectCond);
        return this.select(selectCond);
    }

    /**
     * 填充关系[订单]父数据查询附加条件
     * @param selectCond 查询条件对象
     * @throws Exception
     */
    protected void onFillSelectByIBZ5ORDERCond(SelectCond selectCond) throws Exception {

    }
    /**
      * 通过关系[订单]父数据查询数据（临时数据模式）
      * @param parentEntity 父数据
      * @throws Exception
      */
    public java.util.ArrayList<IBZ5ORDERDETAIL> selectTempByIBZ5ORDER(com.sa.ibiz.demo.srv.demo.entity.IBZ5ORDER parentEntity) throws Exception {
        return selectTempByIBZ5ORDER( parentEntity,"");
    }
    /**
     * 通过关系[订单]父数据查询数据（临时数据模式）
     * @param parentEntity 父数据
     * @param strOrderInfo 排序信息
     * @throws Exception
     */
    public java.util.ArrayList<IBZ5ORDERDETAIL> selectTempByIBZ5ORDER(com.sa.ibiz.demo.srv.demo.entity.IBZ5ORDER parentEntity,String strOrderInfo) throws Exception {
        SelectCond selectCond = new SelectCond();
        selectCond.setConditon(IBZ5ORDERDETAIL.FIELD_IBZ5ORDERID, parentEntity.getIBZ5ORDERId());
        selectCond.setOrderInfo(strOrderInfo);
        onFillSelectTempByIBZ5ORDERCond(selectCond);
        return this.selectTemp(selectCond);
    }

    /**
     * 填充关系[订单]父数据查询附加条件（临时数据模式）
     * @param selectCond 查询条件对象
     * @throws Exception
     */
    protected void onFillSelectTempByIBZ5ORDERCond(SelectCond selectCond) throws Exception {

    }

    /**
     * 通过关系[统一产品（索引主实体）]父数据查询数据
     * @param parentEntity 父数据
     * @throws Exception
     */
    public java.util.ArrayList<IBZ5ORDERDETAIL> selectByIBZ5UNITPRODUCT(com.sa.ibiz.demo.srv.demo.entity.IBZ5UNITPRODUCT parentEntity) throws Exception {
        return selectByIBZ5UNITPRODUCT(parentEntity,"");
    }
    /**
     * 通过关系[统一产品（索引主实体）]父数据查询数据
     * @param parentEntity 父数据
     * @param strOrderInfo 排序信息
     * @throws Exception
     */
    public java.util.ArrayList<IBZ5ORDERDETAIL> selectByIBZ5UNITPRODUCT(com.sa.ibiz.demo.srv.demo.entity.IBZ5UNITPRODUCT parentEntity,String strOrderInfo) throws Exception {
        SelectCond selectCond = new SelectCond();
        selectCond.setConditon(IBZ5ORDERDETAIL.FIELD_IBZ5UNITPRODUCTID, parentEntity.getIBZ5UNITPRODUCTId());
        selectCond.setOrderInfo(strOrderInfo);
        onFillSelectByIBZ5UNITPRODUCTCond(selectCond);
        return this.select(selectCond);
    }

    /**
     * 填充关系[统一产品（索引主实体）]父数据查询附加条件
     * @param selectCond 查询条件对象
     * @throws Exception
     */
    protected void onFillSelectByIBZ5UNITPRODUCTCond(SelectCond selectCond) throws Exception {

    }




    /**
     * 判断是否能够通过关系[订单]删除数据
     * @param parentEntity 父数据
     * @throws Exception
     */
    public void testRemoveByIBZ5ORDER(com.sa.ibiz.demo.srv.demo.entity.IBZ5ORDER parentEntity) throws Exception {
    }


    /**
     * 通过关系[订单]重置数据
     * @param parentEntity 父数据
     * @throws Exception
     */
    public void resetIBZ5ORDER(com.sa.ibiz.demo.srv.demo.entity.IBZ5ORDER parentEntity) throws Exception {
        java.util.ArrayList<IBZ5ORDERDETAIL> list =  this.selectByIBZ5ORDER(parentEntity);
        for(IBZ5ORDERDETAIL item:list) {
            IBZ5ORDERDETAIL item2 = (IBZ5ORDERDETAIL)getDEModel().createEntity();
            item2.setIBZ5ORDERDETAILId(item.getIBZ5ORDERDETAILId());
            item2.setIBZ5ORDERId(null);
            this.update(item2);
        }
    }


    /**
     * 通过关系[订单]删除数据
     * @param parentEntity 父数据
     * @throws Exception
     */
    public void removeByIBZ5ORDER(com.sa.ibiz.demo.srv.demo.entity.IBZ5ORDER parentEntity) throws Exception {
        final com.sa.ibiz.demo.srv.demo.entity.IBZ5ORDER parentEntity2 = parentEntity;
        this.doServiceWork(new IServiceWork() {
            @Override
            public void execute(ITransaction iTransaction) throws Exception {
                onBeforeRemoveByIBZ5ORDER(parentEntity2);
                internalRemoveByIBZ5ORDER(parentEntity2);
                onAfterRemoveByIBZ5ORDER(parentEntity2);
            }
        });
    }

    /**
     * 通过关系[订单]删除数据之前调用
     * @param parentEntity 父数据
     * @throws Exception
     */
    protected void onBeforeRemoveByIBZ5ORDER(com.sa.ibiz.demo.srv.demo.entity.IBZ5ORDER parentEntity) throws Exception {

    }

    /**
    * 内部删除数据，通过关系[订单]
    * @param parentEntity 父数据
    * @throws Exception
    */
    protected void internalRemoveByIBZ5ORDER(com.sa.ibiz.demo.srv.demo.entity.IBZ5ORDER parentEntity) throws Exception {
        java.util.ArrayList<IBZ5ORDERDETAIL> removeList = selectByIBZ5ORDER(parentEntity);
        onBeforeRemoveByIBZ5ORDER(parentEntity,removeList );

        // 执行删除
        for (IBZ5ORDERDETAIL item : removeList ) {
            remove(item );
        }
        onAfterRemoveByIBZ5ORDER(parentEntity,removeList );
    }

    /**
     * 通过关系[订单]删除数据之后调用
     * @param parentEntity 父数据
     * @throws Exception
     */
    protected void onAfterRemoveByIBZ5ORDER(com.sa.ibiz.demo.srv.demo.entity.IBZ5ORDER parentEntity) throws Exception {

    }

    /**
     * 通过关系[订单]删除数据之前调用
     * @param parentEntity 父数据
     * @param removeList 要删除的数据清单
     * @throws Exception
     */
    protected void onBeforeRemoveByIBZ5ORDER(com.sa.ibiz.demo.srv.demo.entity.IBZ5ORDER parentEntity,java.util.ArrayList<IBZ5ORDERDETAIL> removeList) throws Exception {

    }

    /**
     * 通过关系[订单]删除数据之后调用
     * @param parentEntity 父数据
     * @param removeList 要删除的数据清单
     * @throws Exception
     */
    protected void onAfterRemoveByIBZ5ORDER(com.sa.ibiz.demo.srv.demo.entity.IBZ5ORDER parentEntity,java.util.ArrayList<IBZ5ORDERDETAIL> removeList) throws Exception {

    }

    /**
     * 判断是否能够通过关系[统一产品（索引主实体）]删除数据
     * @param parentEntity 父数据
     * @throws Exception
     */
    public void testRemoveByIBZ5UNITPRODUCT(com.sa.ibiz.demo.srv.demo.entity.IBZ5UNITPRODUCT parentEntity) throws Exception {
        java.util.ArrayList<IBZ5ORDERDETAIL> list =  this.selectByIBZ5UNITPRODUCT(parentEntity);
        if(list.size()>0) {
            IDataEntityModel parentDEModel = this.getDEModel().getSystemRuntime().getDataEntityModel("IBZ5UNITPRODUCT");
            parentDEModel.getService(this.getSessionFactory()).getCache(parentEntity);
            throw new Exception(getRemoveRejectMsg("DER1N_IBZ5ORDERDETAIL_IBZ5UNITPRODUCT_IBZ5UNITPRODUCTID","" ,parentDEModel.getName(),"IBZ5ORDERDETAIL",parentDEModel.getDataInfo(parentEntity)));
        }
    }


    /**
     * 通过关系[统一产品（索引主实体）]重置数据
     * @param parentEntity 父数据
     * @throws Exception
     */
    public void resetIBZ5UNITPRODUCT(com.sa.ibiz.demo.srv.demo.entity.IBZ5UNITPRODUCT parentEntity) throws Exception {
        java.util.ArrayList<IBZ5ORDERDETAIL> list =  this.selectByIBZ5UNITPRODUCT(parentEntity);
        for(IBZ5ORDERDETAIL item:list) {
            IBZ5ORDERDETAIL item2 = (IBZ5ORDERDETAIL)getDEModel().createEntity();
            item2.setIBZ5ORDERDETAILId(item.getIBZ5ORDERDETAILId());
            item2.setIBZ5UNITPRODUCTId(null);
            this.update(item2);
        }
    }


    /**
     * 通过关系[统一产品（索引主实体）]删除数据
     * @param parentEntity 父数据
     * @throws Exception
     */
    public void removeByIBZ5UNITPRODUCT(com.sa.ibiz.demo.srv.demo.entity.IBZ5UNITPRODUCT parentEntity) throws Exception {
        final com.sa.ibiz.demo.srv.demo.entity.IBZ5UNITPRODUCT parentEntity2 = parentEntity;
        this.doServiceWork(new IServiceWork() {
            @Override
            public void execute(ITransaction iTransaction) throws Exception {
                onBeforeRemoveByIBZ5UNITPRODUCT(parentEntity2);
                internalRemoveByIBZ5UNITPRODUCT(parentEntity2);
                onAfterRemoveByIBZ5UNITPRODUCT(parentEntity2);
            }
        });
    }

    /**
     * 通过关系[统一产品（索引主实体）]删除数据之前调用
     * @param parentEntity 父数据
     * @throws Exception
     */
    protected void onBeforeRemoveByIBZ5UNITPRODUCT(com.sa.ibiz.demo.srv.demo.entity.IBZ5UNITPRODUCT parentEntity) throws Exception {

    }

    /**
    * 内部删除数据，通过关系[统一产品（索引主实体）]
    * @param parentEntity 父数据
    * @throws Exception
    */
    protected void internalRemoveByIBZ5UNITPRODUCT(com.sa.ibiz.demo.srv.demo.entity.IBZ5UNITPRODUCT parentEntity) throws Exception {
        java.util.ArrayList<IBZ5ORDERDETAIL> removeList = selectByIBZ5UNITPRODUCT(parentEntity);
        onBeforeRemoveByIBZ5UNITPRODUCT(parentEntity,removeList );

        // 执行删除
        for (IBZ5ORDERDETAIL item : removeList ) {
            remove(item );
        }
        onAfterRemoveByIBZ5UNITPRODUCT(parentEntity,removeList );
    }

    /**
     * 通过关系[统一产品（索引主实体）]删除数据之后调用
     * @param parentEntity 父数据
     * @throws Exception
     */
    protected void onAfterRemoveByIBZ5UNITPRODUCT(com.sa.ibiz.demo.srv.demo.entity.IBZ5UNITPRODUCT parentEntity) throws Exception {

    }

    /**
     * 通过关系[统一产品（索引主实体）]删除数据之前调用
     * @param parentEntity 父数据
     * @param removeList 要删除的数据清单
     * @throws Exception
     */
    protected void onBeforeRemoveByIBZ5UNITPRODUCT(com.sa.ibiz.demo.srv.demo.entity.IBZ5UNITPRODUCT parentEntity,java.util.ArrayList<IBZ5ORDERDETAIL> removeList) throws Exception {

    }

    /**
     * 通过关系[统一产品（索引主实体）]删除数据之后调用
     * @param parentEntity 父数据
     * @param removeList 要删除的数据清单
     * @throws Exception
     */
    protected void onAfterRemoveByIBZ5UNITPRODUCT(com.sa.ibiz.demo.srv.demo.entity.IBZ5UNITPRODUCT parentEntity,java.util.ArrayList<IBZ5ORDERDETAIL> removeList) throws Exception {

    }

    /* (non-Javadoc)
     * @see net.ibizsys.paas.service.ServiceBase#onBeforeRemove(net.ibizsys.paas.entity.IEntity)
     */
    @Override
    protected void onBeforeRemove(IBZ5ORDERDETAIL et) throws Exception {
        super.onBeforeRemove(et);
    }


    /**
    * 通过关系[订单]删除数据（临时数据模式）
    * @param parentEntity 父数据
    * @throws Exception
    */
    public void removeTempByIBZ5ORDER(com.sa.ibiz.demo.srv.demo.entity.IBZ5ORDER parentEntity) throws Exception {
        final com.sa.ibiz.demo.srv.demo.entity.IBZ5ORDER parentEntity2 = parentEntity;
        this.doServiceWork(new IServiceWork() {
            @Override
            public void execute(ITransaction iTransaction) throws Exception {
                onBeforeRemoveTempByIBZ5ORDER(parentEntity2);
                internalRemoveTempByIBZ5ORDER(parentEntity2);
                onAfterRemoveTempByIBZ5ORDER(parentEntity2);
            }
        });
    }

    /**
     * 通过关系[订单]删除数据之前调用（临时数据模式）
     * @param parentEntity 父数据
     * @throws Exception
     */
    protected void onBeforeRemoveTempByIBZ5ORDER(com.sa.ibiz.demo.srv.demo.entity.IBZ5ORDER parentEntity) throws Exception {

    }

    /**
    * 通过关系[订单]删除数据之后调用（临时数据模式）
    * @param parentEntity 父数据
    * @throws Exception
    */
    protected void internalRemoveTempByIBZ5ORDER(com.sa.ibiz.demo.srv.demo.entity.IBZ5ORDER parentEntity) throws Exception {
        java.util.ArrayList<IBZ5ORDERDETAIL> removeList = selectTempByIBZ5ORDER(parentEntity);
        onBeforeRemoveTempByIBZ5ORDER(parentEntity,removeList );

        //逐个执行删除
        for (IBZ5ORDERDETAIL item : removeList ) {
            removeTemp(item );
        }
        onAfterRemoveTempByIBZ5ORDER(parentEntity,removeList );
    }

    /**
     * 通过关系[订单]删除数据之后调用（临时数据模式）
     * @param parentEntity 父数据
     * @throws Exception
     */
    protected void onAfterRemoveTempByIBZ5ORDER(com.sa.ibiz.demo.srv.demo.entity.IBZ5ORDER parentEntity) throws Exception {

    }

    /**
     * 通过关系[订单]删除数据之前调用（临时数据模式）
     * @param parentEntity 父数据
     * @param removeList 删除数据清单
     * @throws Exception
     */
    protected void onBeforeRemoveTempByIBZ5ORDER(com.sa.ibiz.demo.srv.demo.entity.IBZ5ORDER parentEntity,java.util.ArrayList<IBZ5ORDERDETAIL> removeList) throws Exception {

    }

    /**
     * 通过关系[订单]删除数据之后调用（临时数据模式）
     * @param parentEntity 父数据
     * @param removeList 删除数据清单
     * @throws Exception
     */
    protected void onAfterRemoveTempByIBZ5ORDER(com.sa.ibiz.demo.srv.demo.entity.IBZ5ORDER parentEntity,java.util.ArrayList<IBZ5ORDERDETAIL> removeList) throws Exception {

    }



    /**
     * 替换父数据信息
     * @param et
     * @throws Exception
     */
    @Override
    protected void replaceParentInfo(IBZ5ORDERDETAIL et,CloneSession cloneSession) throws Exception {
        super.replaceParentInfo(et, cloneSession);
        //循环所有的从关系，判断有误替换
        if(et.getIBZ5ORDERId()!=null) {
            IEntity entity = cloneSession.getEntity("IBZ5ORDER",et.getIBZ5ORDERId());
            if(entity !=null) {
                onFillParentInfo_IBZ5ORDER(et,(com.sa.ibiz.demo.srv.demo.entity.IBZ5ORDER) entity);
            }
        }
        if(et.getIBZ5UNITPRODUCTId()!=null) {
            IEntity entity = cloneSession.getEntity("IBZ5UNITPRODUCT",et.getIBZ5UNITPRODUCTId());
            if(entity !=null) {
                onFillParentInfo_IBZ5UNITPRODUCT(et,(com.sa.ibiz.demo.srv.demo.entity.IBZ5UNITPRODUCT) entity);
            }
        }
    }

    /* (non-Javadoc)
     * @see net.ibizsys.paas.service.ServiceBase#onRemoveEntityUncopyValues(net.ibizsys.paas.entity.IEntity, boolean)
     */
    @Override
    protected void onRemoveEntityUncopyValues(IBZ5ORDERDETAIL et, boolean bTempMode) throws Exception {
        super.onRemoveEntityUncopyValues(et,  bTempMode);
    }


    /* (non-Javadoc)
     * @see net.ibizsys.paas.service.ServiceBase#onCheckEntity(boolean, net.ibizsys.paas.entity.IEntity, boolean, boolean, net.ibizsys.paas.entity.EntityError)
     */
    @Override
    protected void onCheckEntity(boolean bBaseMode,IBZ5ORDERDETAIL  et, boolean bCreate, boolean bTempMode,EntityError entityError) throws Exception {
        EntityFieldError entityFieldError = null;
        //检查属性 订单明细标识
        entityFieldError = onCheckField_IBZ5ORDERDETAILId( bBaseMode,  et,  bCreate,  bTempMode);
        if(entityFieldError!=null) {
            entityError.register(entityFieldError);
        }
        //检查属性 订单明细名称
        entityFieldError = onCheckField_IBZ5ORDERDETAILName( bBaseMode,  et,  bCreate,  bTempMode);
        if(entityFieldError!=null) {
            entityError.register(entityFieldError);
        }
        //检查属性 订单标识
        entityFieldError = onCheckField_IBZ5ORDERId( bBaseMode,  et,  bCreate,  bTempMode);
        if(entityFieldError!=null) {
            entityError.register(entityFieldError);
        }
        //检查属性 统一产品标识
        entityFieldError = onCheckField_IBZ5UNITPRODUCTId( bBaseMode,  et,  bCreate,  bTempMode);
        if(entityFieldError!=null) {
            entityError.register(entityFieldError);
        }
        //检查属性 数量
        entityFieldError = onCheckField_QUANTITY( bBaseMode,  et,  bCreate,  bTempMode);
        if(entityFieldError!=null) {
            entityError.register(entityFieldError);
        }
        super.onCheckEntity(bBaseMode,et,  bCreate,bTempMode,entityError);
    }


    /**
     * 获取属性[IBZ5ORDERDETAILId]值错误
     * @param bBaseMode 是否为基本检查模式，基本检查模式执行值类型，长度及属性值规则检查，非基本模式进行重复值检查
     * @param et 当前数据对象
     * @param bCreate 是否为新建数据
     * @param bTempMode 是否为临时数据模式
     * @throws Exception
     */
    protected EntityFieldError onCheckField_IBZ5ORDERDETAILId(boolean bBaseMode,IBZ5ORDERDETAIL et, boolean bCreate, boolean bTempMode) throws Exception {
        //判断是否有值
        if(!et.isIBZ5ORDERDETAILIdDirty())
            return null;

        String value = et.getIBZ5ORDERDETAILId();
        if(bBaseMode) {
            if(bCreate) {
                if(StringHelper.isNullOrEmpty(value)) {
                    EntityFieldError entityFieldError = new EntityFieldError();
                    entityFieldError.setFieldName(IBZ5ORDERDETAIL.FIELD_IBZ5ORDERDETAILID);
                    entityFieldError.setErrorType(EntityFieldError.ERROR_EMPTY);
                    return entityFieldError;
                }
            }

            String strRuleInfo  = null;
            //检查值规则[默认规则]
            strRuleInfo =onTestValueRule_IBZ5ORDERDETAILId_Default( et,  bCreate,  bTempMode);
            if(!StringHelper.isNullOrEmpty(strRuleInfo)) {
                EntityFieldError entityFieldError = new EntityFieldError();
                entityFieldError.setFieldName(IBZ5ORDERDETAIL.FIELD_IBZ5ORDERDETAILID);
                entityFieldError.setErrorType(EntityFieldError.ERROR_VALUERULE);
                entityFieldError.setErrorInfo(strRuleInfo);
                return entityFieldError;
            }
        } else {
        }
        return null;
    }


    /**
     * 获取属性[IBZ5ORDERDETAILName]值错误
     * @param bBaseMode 是否为基本检查模式，基本检查模式执行值类型，长度及属性值规则检查，非基本模式进行重复值检查
     * @param et 当前数据对象
     * @param bCreate 是否为新建数据
     * @param bTempMode 是否为临时数据模式
     * @throws Exception
     */
    protected EntityFieldError onCheckField_IBZ5ORDERDETAILName(boolean bBaseMode,IBZ5ORDERDETAIL et, boolean bCreate, boolean bTempMode) throws Exception {
        //判断是否有值
        if(!et.isIBZ5ORDERDETAILNameDirty())
            return null;

        String value = et.getIBZ5ORDERDETAILName();
        if(bBaseMode) {
            if(bCreate) {
            }

            String strRuleInfo  = null;
            //检查值规则[默认规则]
            strRuleInfo =onTestValueRule_IBZ5ORDERDETAILName_Default( et,  bCreate,  bTempMode);
            if(!StringHelper.isNullOrEmpty(strRuleInfo)) {
                EntityFieldError entityFieldError = new EntityFieldError();
                entityFieldError.setFieldName(IBZ5ORDERDETAIL.FIELD_IBZ5ORDERDETAILNAME);
                entityFieldError.setErrorType(EntityFieldError.ERROR_VALUERULE);
                entityFieldError.setErrorInfo(strRuleInfo);
                return entityFieldError;
            }
        } else {
        }
        return null;
    }


    /**
     * 获取属性[IBZ5ORDERId]值错误
     * @param bBaseMode 是否为基本检查模式，基本检查模式执行值类型，长度及属性值规则检查，非基本模式进行重复值检查
     * @param et 当前数据对象
     * @param bCreate 是否为新建数据
     * @param bTempMode 是否为临时数据模式
     * @throws Exception
     */
    protected EntityFieldError onCheckField_IBZ5ORDERId(boolean bBaseMode,IBZ5ORDERDETAIL et, boolean bCreate, boolean bTempMode) throws Exception {
        //判断是否有值
        if(!et.isIBZ5ORDERIdDirty())
            return null;

        String value = et.getIBZ5ORDERId();
        if(bBaseMode) {
            if(bCreate) {
            }

            String strRuleInfo  = null;
            //检查值规则[默认规则]
            strRuleInfo =onTestValueRule_IBZ5ORDERId_Default( et,  bCreate,  bTempMode);
            if(!StringHelper.isNullOrEmpty(strRuleInfo)) {
                EntityFieldError entityFieldError = new EntityFieldError();
                entityFieldError.setFieldName(IBZ5ORDERDETAIL.FIELD_IBZ5ORDERID);
                entityFieldError.setErrorType(EntityFieldError.ERROR_VALUERULE);
                entityFieldError.setErrorInfo(strRuleInfo);
                return entityFieldError;
            }
        } else {
        }
        return null;
    }


    /**
     * 获取属性[IBZ5UNITPRODUCTId]值错误
     * @param bBaseMode 是否为基本检查模式，基本检查模式执行值类型，长度及属性值规则检查，非基本模式进行重复值检查
     * @param et 当前数据对象
     * @param bCreate 是否为新建数据
     * @param bTempMode 是否为临时数据模式
     * @throws Exception
     */
    protected EntityFieldError onCheckField_IBZ5UNITPRODUCTId(boolean bBaseMode,IBZ5ORDERDETAIL et, boolean bCreate, boolean bTempMode) throws Exception {
        //判断是否有值
        if(!et.isIBZ5UNITPRODUCTIdDirty())
            return null;

        String value = et.getIBZ5UNITPRODUCTId();
        if(bBaseMode) {
            if(bCreate) {
            }

            String strRuleInfo  = null;
            //检查值规则[默认规则]
            strRuleInfo =onTestValueRule_IBZ5UNITPRODUCTId_Default( et,  bCreate,  bTempMode);
            if(!StringHelper.isNullOrEmpty(strRuleInfo)) {
                EntityFieldError entityFieldError = new EntityFieldError();
                entityFieldError.setFieldName(IBZ5ORDERDETAIL.FIELD_IBZ5UNITPRODUCTID);
                entityFieldError.setErrorType(EntityFieldError.ERROR_VALUERULE);
                entityFieldError.setErrorInfo(strRuleInfo);
                return entityFieldError;
            }
        } else {
        }
        return null;
    }


    /**
     * 获取属性[QUANTITY]值错误
     * @param bBaseMode 是否为基本检查模式，基本检查模式执行值类型，长度及属性值规则检查，非基本模式进行重复值检查
     * @param et 当前数据对象
     * @param bCreate 是否为新建数据
     * @param bTempMode 是否为临时数据模式
     * @throws Exception
     */
    protected EntityFieldError onCheckField_QUANTITY(boolean bBaseMode,IBZ5ORDERDETAIL et, boolean bCreate, boolean bTempMode) throws Exception {
        //判断是否有值
        if(!et.isQUANTITYDirty())
            return null;

        Integer value = et.getQUANTITY();
        if(bBaseMode) {
            if(bCreate) {
            }

            String strRuleInfo  = null;
            //检查值规则[值范围为1到100]
            strRuleInfo =onTestValueRule_QUANTITY_Logic_1To100( et,  bCreate,  bTempMode);
            if(!StringHelper.isNullOrEmpty(strRuleInfo)) {
                EntityFieldError entityFieldError = new EntityFieldError();
                entityFieldError.setFieldName(IBZ5ORDERDETAIL.FIELD_QUANTITY);
                entityFieldError.setErrorType(EntityFieldError.ERROR_VALUERULE);
                entityFieldError.setErrorInfo(strRuleInfo);
                return entityFieldError;
            }
            //检查值规则[默认规则]
            strRuleInfo =onTestValueRule_QUANTITY_Default( et,  bCreate,  bTempMode);
            if(!StringHelper.isNullOrEmpty(strRuleInfo)) {
                EntityFieldError entityFieldError = new EntityFieldError();
                entityFieldError.setFieldName(IBZ5ORDERDETAIL.FIELD_QUANTITY);
                entityFieldError.setErrorType(EntityFieldError.ERROR_VALUERULE);
                entityFieldError.setErrorInfo(strRuleInfo);
                return entityFieldError;
            }
        } else {
        }
        return null;
    }




    /* (non-Javadoc)
     * @see net.ibizsys.paas.service.ServiceBase#onSyncEntity(net.ibizsys.paas.entity.IEntity, boolean)
     */
    @Override
    protected void onSyncEntity(IBZ5ORDERDETAIL et, boolean bRemove) throws Exception {
        super.onSyncEntity( et,  bRemove);
    }


    /* (non-Javadoc)
     * @see net.ibizsys.paas.service.ServiceBase#onSyncIndexEntities(net.ibizsys.paas.entity.IEntity, boolean)
     */
    @Override
    protected void onSyncIndexEntities(IBZ5ORDERDETAIL et,boolean bRemove) throws Exception {
        super.onSyncIndexEntities(et,bRemove);
    }


    /* (non-Javadoc)
     * @see net.ibizsys.paas.service.ServiceBase#getDataContextValue(net.ibizsys.paas.entity.IEntity, java.lang.String, net.ibizsys.paas.service.IDataContextParam)
     */
    @Override
    public Object getDataContextValue(IBZ5ORDERDETAIL et,String strField,IDataContextParam iDataContextParam)throws Exception {
        Object objValue = null;
        if(iDataContextParam!=null) {
        }

        objValue = super.getDataContextValue(et,strField,iDataContextParam);
        if(objValue!=null)
            return objValue;

        return null;
    }



    /* (non-Javadoc)
     * @see net.ibizsys.paas.service.ServiceBase#onTestValueRule(java.lang.String, java.lang.String, net.ibizsys.paas.entity.IEntity, boolean, boolean)
     */
    @Override
    protected String onTestValueRule(String strDEFieldName,String strRule,IEntity et,boolean bCreate,boolean bTempMode) throws Exception {
        if((StringHelper.compare(strDEFieldName,IBZ5ORDERDETAIL.FIELD_CREATEDATE,true)==0)
                &&(StringHelper.compare(strRule,"DEFAULT",true)==0))
            return onTestValueRule_CreateDate_Default(et,bCreate,bTempMode);
        if((StringHelper.compare(strDEFieldName,IBZ5ORDERDETAIL.FIELD_IBZ5ORDERDETAILNAME,true)==0)
                &&(StringHelper.compare(strRule,"DEFAULT",true)==0))
            return onTestValueRule_IBZ5ORDERDETAILName_Default(et,bCreate,bTempMode);
        if((StringHelper.compare(strDEFieldName,IBZ5ORDERDETAIL.FIELD_CREATEMAN,true)==0)
                &&(StringHelper.compare(strRule,"DEFAULT",true)==0))
            return onTestValueRule_CreateMan_Default(et,bCreate,bTempMode);
        if((StringHelper.compare(strDEFieldName,IBZ5ORDERDETAIL.FIELD_QUANTITY,true)==0)
                &&(StringHelper.compare(strRule,"LOGIC_1TO100",true)==0))
            return onTestValueRule_QUANTITY_Logic_1To100(et,bCreate,bTempMode);
        if((StringHelper.compare(strDEFieldName,IBZ5ORDERDETAIL.FIELD_QUANTITY,true)==0)
                &&(StringHelper.compare(strRule,"DEFAULT",true)==0))
            return onTestValueRule_QUANTITY_Default(et,bCreate,bTempMode);
        if((StringHelper.compare(strDEFieldName,IBZ5ORDERDETAIL.FIELD_UPDATEMAN,true)==0)
                &&(StringHelper.compare(strRule,"DEFAULT",true)==0))
            return onTestValueRule_UpdateMan_Default(et,bCreate,bTempMode);
        if((StringHelper.compare(strDEFieldName,IBZ5ORDERDETAIL.FIELD_AMOUNT,true)==0)
                &&(StringHelper.compare(strRule,"DEFAULT",true)==0))
            return onTestValueRule_Amount_Default(et,bCreate,bTempMode);
        if((StringHelper.compare(strDEFieldName,IBZ5ORDERDETAIL.FIELD_IBZ5ORDERDETAILID,true)==0)
                &&(StringHelper.compare(strRule,"DEFAULT",true)==0))
            return onTestValueRule_IBZ5ORDERDETAILId_Default(et,bCreate,bTempMode);
        if((StringHelper.compare(strDEFieldName,IBZ5ORDERDETAIL.FIELD_UPDATEDATE,true)==0)
                &&(StringHelper.compare(strRule,"DEFAULT",true)==0))
            return onTestValueRule_UpdateDate_Default(et,bCreate,bTempMode);
        if((StringHelper.compare(strDEFieldName,IBZ5ORDERDETAIL.FIELD_IBZ5ORDERNAME,true)==0)
                &&(StringHelper.compare(strRule,"DEFAULT",true)==0))
            return onTestValueRule_IBZ5ORDERName_Default(et,bCreate,bTempMode);
        if((StringHelper.compare(strDEFieldName,IBZ5ORDERDETAIL.FIELD_UNITPRICE,true)==0)
                &&(StringHelper.compare(strRule,"DEFAULT",true)==0))
            return onTestValueRule_UnitPrice_Default(et,bCreate,bTempMode);
        if((StringHelper.compare(strDEFieldName,IBZ5ORDERDETAIL.FIELD_UNIT,true)==0)
                &&(StringHelper.compare(strRule,"DEFAULT",true)==0))
            return onTestValueRule_UNIT_Default(et,bCreate,bTempMode);
        if((StringHelper.compare(strDEFieldName,IBZ5ORDERDETAIL.FIELD_ORDERUID,true)==0)
                &&(StringHelper.compare(strRule,"DEFAULT",true)==0))
            return onTestValueRule_ORDERUID_Default(et,bCreate,bTempMode);
        if((StringHelper.compare(strDEFieldName,IBZ5ORDERDETAIL.FIELD_IBZ5UNITPRODUCTNAME,true)==0)
                &&(StringHelper.compare(strRule,"DEFAULT",true)==0))
            return onTestValueRule_IBZ5UNITPRODUCTName_Default(et,bCreate,bTempMode);
        if((StringHelper.compare(strDEFieldName,IBZ5ORDERDETAIL.FIELD_IBZ5UNITPRODUCTID,true)==0)
                &&(StringHelper.compare(strRule,"DEFAULT",true)==0))
            return onTestValueRule_IBZ5UNITPRODUCTId_Default(et,bCreate,bTempMode);
        if((StringHelper.compare(strDEFieldName,IBZ5ORDERDETAIL.FIELD_IBZ5ORDERID,true)==0)
                &&(StringHelper.compare(strRule,"DEFAULT",true)==0))
            return onTestValueRule_IBZ5ORDERId_Default(et,bCreate,bTempMode);

        return super.onTestValueRule( strDEFieldName, strRule, et,bCreate, bTempMode);
    }

    /**
     * 判断值规则[建立时间][默认规则]
     * @param et 当前数据对象
     * @param bCreate 是否为新建数据模式
     * @param bTempMode 是否为临时数据模式
     * @return
     * @throws Exception
     */
    protected String onTestValueRule_CreateDate_Default(IEntity et,boolean bCreate,boolean bTempMode) throws Exception {
        return null;
    }

    /**
     * 判断值规则[订单明细名称][默认规则]
     * @param et 当前数据对象
     * @param bCreate 是否为新建数据模式
     * @param bTempMode 是否为临时数据模式
     * @return
     * @throws Exception
     */
    protected String onTestValueRule_IBZ5ORDERDETAILName_Default(IEntity et,boolean bCreate,boolean bTempMode) throws Exception {
        try {
            if((checkFieldStringLengthRule("IBZ5ORDERDETAILNAME", et, bTempMode,null,false,200,true,"内容长度必须小于等于[200]")))
                return null;
            return "内容长度必须小于等于[200]";
        } catch(Exception ex) {
            return ex.getMessage();
        }
    }

    /**
     * 判断值规则[建立人][默认规则]
     * @param et 当前数据对象
     * @param bCreate 是否为新建数据模式
     * @param bTempMode 是否为临时数据模式
     * @return
     * @throws Exception
     */
    protected String onTestValueRule_CreateMan_Default(IEntity et,boolean bCreate,boolean bTempMode) throws Exception {
        try {
            if((checkFieldStringLengthRule("CREATEMAN", et, bTempMode,null,false,60,true,"内容长度必须小于等于[60]")))
                return null;
            return "内容长度必须小于等于[60]";
        } catch(Exception ex) {
            return ex.getMessage();
        }
    }

    /**
     * 判断值规则[数量][值范围为1到100]
     * @param et 当前数据对象
     * @param bCreate 是否为新建数据模式
     * @param bTempMode 是否为临时数据模式
     * @return
     * @throws Exception
     */
    protected String onTestValueRule_QUANTITY_Logic_1To100(IEntity et,boolean bCreate,boolean bTempMode) throws Exception {
        try {
            if((checkFieldValueRangeRule("QUANTITY", et, bTempMode,new Double(1),true,new Double(100),true,"值大于1小于100")))
                return null;
            return "值大于1小于100";
        } catch(Exception ex) {
            return ex.getMessage();
        }
    }

    /**
     * 判断值规则[数量][默认规则]
     * @param et 当前数据对象
     * @param bCreate 是否为新建数据模式
     * @param bTempMode 是否为临时数据模式
     * @return
     * @throws Exception
     */
    protected String onTestValueRule_QUANTITY_Default(IEntity et,boolean bCreate,boolean bTempMode) throws Exception {
        return null;
    }

    /**
     * 判断值规则[更新人][默认规则]
     * @param et 当前数据对象
     * @param bCreate 是否为新建数据模式
     * @param bTempMode 是否为临时数据模式
     * @return
     * @throws Exception
     */
    protected String onTestValueRule_UpdateMan_Default(IEntity et,boolean bCreate,boolean bTempMode) throws Exception {
        try {
            if((checkFieldStringLengthRule("UPDATEMAN", et, bTempMode,null,false,60,true,"内容长度必须小于等于[60]")))
                return null;
            return "内容长度必须小于等于[60]";
        } catch(Exception ex) {
            return ex.getMessage();
        }
    }

    /**
     * 判断值规则[小计][默认规则]
     * @param et 当前数据对象
     * @param bCreate 是否为新建数据模式
     * @param bTempMode 是否为临时数据模式
     * @return
     * @throws Exception
     */
    protected String onTestValueRule_Amount_Default(IEntity et,boolean bCreate,boolean bTempMode) throws Exception {
        return null;
    }

    /**
     * 判断值规则[订单明细标识][默认规则]
     * @param et 当前数据对象
     * @param bCreate 是否为新建数据模式
     * @param bTempMode 是否为临时数据模式
     * @return
     * @throws Exception
     */
    protected String onTestValueRule_IBZ5ORDERDETAILId_Default(IEntity et,boolean bCreate,boolean bTempMode) throws Exception {
        try {
            if((checkFieldStringLengthRule("IBZ5ORDERDETAILID", et, bTempMode,null,false,100,true,"内容长度必须小于等于[100]")))
                return null;
            return "内容长度必须小于等于[100]";
        } catch(Exception ex) {
            return ex.getMessage();
        }
    }

    /**
     * 判断值规则[更新时间][默认规则]
     * @param et 当前数据对象
     * @param bCreate 是否为新建数据模式
     * @param bTempMode 是否为临时数据模式
     * @return
     * @throws Exception
     */
    protected String onTestValueRule_UpdateDate_Default(IEntity et,boolean bCreate,boolean bTempMode) throws Exception {
        return null;
    }

    /**
     * 判断值规则[订单名称][默认规则]
     * @param et 当前数据对象
     * @param bCreate 是否为新建数据模式
     * @param bTempMode 是否为临时数据模式
     * @return
     * @throws Exception
     */
    protected String onTestValueRule_IBZ5ORDERName_Default(IEntity et,boolean bCreate,boolean bTempMode) throws Exception {
        try {
            if((checkFieldStringLengthRule("IBZ5ORDERNAME", et, bTempMode,null,false,200,true,"内容长度必须小于等于[200]")))
                return null;
            return "内容长度必须小于等于[200]";
        } catch(Exception ex) {
            return ex.getMessage();
        }
    }

    /**
     * 判断值规则[单价][默认规则]
     * @param et 当前数据对象
     * @param bCreate 是否为新建数据模式
     * @param bTempMode 是否为临时数据模式
     * @return
     * @throws Exception
     */
    protected String onTestValueRule_UnitPrice_Default(IEntity et,boolean bCreate,boolean bTempMode) throws Exception {
        return null;
    }

    /**
     * 判断值规则[单位][默认规则]
     * @param et 当前数据对象
     * @param bCreate 是否为新建数据模式
     * @param bTempMode 是否为临时数据模式
     * @return
     * @throws Exception
     */
    protected String onTestValueRule_UNIT_Default(IEntity et,boolean bCreate,boolean bTempMode) throws Exception {
        try {
            if((checkFieldStringLengthRule("UNIT", et, bTempMode,null,false,200,true,"内容长度必须小于等于[200]")))
                return null;
            return "内容长度必须小于等于[200]";
        } catch(Exception ex) {
            return ex.getMessage();
        }
    }

    /**
     * 判断值规则[订单编号][默认规则]
     * @param et 当前数据对象
     * @param bCreate 是否为新建数据模式
     * @param bTempMode 是否为临时数据模式
     * @return
     * @throws Exception
     */
    protected String onTestValueRule_ORDERUID_Default(IEntity et,boolean bCreate,boolean bTempMode) throws Exception {
        try {
            if((checkFieldStringLengthRule("ORDERUID", et, bTempMode,null,false,100,true,"内容长度必须小于等于[100]")))
                return null;
            return "内容长度必须小于等于[100]";
        } catch(Exception ex) {
            return ex.getMessage();
        }
    }

    /**
     * 判断值规则[统一产品名称][默认规则]
     * @param et 当前数据对象
     * @param bCreate 是否为新建数据模式
     * @param bTempMode 是否为临时数据模式
     * @return
     * @throws Exception
     */
    protected String onTestValueRule_IBZ5UNITPRODUCTName_Default(IEntity et,boolean bCreate,boolean bTempMode) throws Exception {
        try {
            if((checkFieldStringLengthRule("IBZ5UNITPRODUCTNAME", et, bTempMode,null,false,200,true,"内容长度必须小于等于[200]")))
                return null;
            return "内容长度必须小于等于[200]";
        } catch(Exception ex) {
            return ex.getMessage();
        }
    }

    /**
     * 判断值规则[统一产品标识][默认规则]
     * @param et 当前数据对象
     * @param bCreate 是否为新建数据模式
     * @param bTempMode 是否为临时数据模式
     * @return
     * @throws Exception
     */
    protected String onTestValueRule_IBZ5UNITPRODUCTId_Default(IEntity et,boolean bCreate,boolean bTempMode) throws Exception {
        try {
            if((checkFieldStringLengthRule("IBZ5UNITPRODUCTID", et, bTempMode,null,false,100,true,"内容长度必须小于等于[100]")))
                return null;
            return "内容长度必须小于等于[100]";
        } catch(Exception ex) {
            return ex.getMessage();
        }
    }

    /**
     * 判断值规则[订单标识][默认规则]
     * @param et 当前数据对象
     * @param bCreate 是否为新建数据模式
     * @param bTempMode 是否为临时数据模式
     * @return
     * @throws Exception
     */
    protected String onTestValueRule_IBZ5ORDERId_Default(IEntity et,boolean bCreate,boolean bTempMode) throws Exception {
        try {
            if((checkFieldStringLengthRule("IBZ5ORDERID", et, bTempMode,null,false,100,true,"内容长度必须小于等于[100]")))
                return null;
            return "内容长度必须小于等于[100]";
        } catch(Exception ex) {
            return ex.getMessage();
        }
    }



    /* (non-Javadoc)
     * @see net.ibizsys.paas.service.ServiceBase#onMergeChild(java.lang.String, java.lang.String, net.ibizsys.paas.entity.IEntity)
     */
    @Override
    protected boolean onMergeChild(String strChildType, String strTypeParam, IBZ5ORDERDETAIL et) throws Exception {
        boolean bRet = false;
        if(super.onMergeChild( strChildType, strTypeParam,  et))
            bRet = true;
        return bRet;
    }



    /**
     * 更新父数据
     * @param et
     * @throws Exception
     */
    @Override
    protected void onUpdateParent(IBZ5ORDERDETAIL et)throws Exception {
        //关系类型 : DER1N ,主实体 :IBZ5ORDER / 订单
        if(true) {
            Object objParentKey = et.get("IBZ5ORDERID");
            if(objParentKey!=null) {
                IService iService= ServiceGlobal.getService("com.sa.ibiz.demo.srv.demo.service.IBZ5ORDERService",this.getSessionFactory());
                iService.mergeChild("DER1N","DER1N_IBZ5ORDERDETAIL_IBZ5ORDER_IBZ5ORDERID",objParentKey);
            }
        }
        super.onUpdateParent(et);
    }

    /**
     * 是否需要更新父数据
     * @return
     */
    @Override
    protected boolean isNeedUpdateParent() {
        return true;
    }

}